package com.ctrl.riveradministrator.mvp.presenter;

import android.util.Log;

import com.ctrl.riveradministrator.base.BaseObserver;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.RaApplication;
import com.ctrl.riveradministrator.mvp.model.Problem;
import com.ctrl.riveradministrator.mvp.view.activity.problem_list.ProblemListView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class ProblemListPresenter extends BasePresenter<ProblemListView> {

    public ProblemListPresenter(ProblemListView baseView) {
        super(baseView);
    }


    public void getSuggests() {
        Map<String, String> map = new HashMap<>();
        map.put("userId", Objects.requireNonNull(RaApplication.getUserId()));
        attachView(apiService.getProblems(map), new BaseObserver<Problem>(getBaseView()) {
            @Override
            public void onSuccess(Problem model) {
                Log.d("onSuccess", ":");
            }

            @Override
            public void onSuccess(List<Problem> model) {
                getBaseView().showMessage(model);
            }

            @Override
            public void onFailed(String msg) {
                Log.d("onFailed", ":" + msg);
            }

        });
    }

 /*   public void feedback(String id,String disposeDescribe) {
        Map<String, String> map = new HashMap<>();
        map.put("problemId", id);
        map.put("disposeDescribe", disposeDescribe);
        attachView(apiService.feedback(map), new BaseObserver<Problem>(getBaseView()) {
            @Override
            public void onSuccess(Problem model) {
                getBaseView().showMessage(null);
                Log.d("onSuccess", ":");
            }

            @Override
            public void onSuccess(List<Problem> model) {
                getBaseView().showMessage(model);
            }

            @Override
            public void onFailed(String msg) {
                Log.d("onFailed", ":" + msg);
            }

        });
    }*/

}